# -*- coding: utf-8 -*-
"""
Created on Mon Sep 25 18:01:01 2023

@author: Dell
"""

import numpy as np

# 哪个网格的结果
level = 4

# 读取DAT文件
with open('level' + str(level) + '_u_v_p_rho.dat', 'r') as file:
    lines = file.readlines()

# 忽略第一行
lines = lines[1:]

# 解析数据并存储为NumPy数组
data = []
for line in lines:
    values = line.split(',')
    values = [float(val.strip()) for val in values]
    data.append(values)

data = np.array(data)

# 打印结果
print(data)

# x, y, u, v, pressure, density   
fluent_results = np.vstack((data[:,1], data[:,2], data[:,5], data[:,6], data[:,3], data[:,4])).T
np.save('level' + str(level) + '_fluent_results.npy', fluent_results)